.\" perp-setup.8
.\" wcm, 2009.12.23 - 2011.03.21
.\" ===
.TH perp-setup 8 "January 2013" "perp-2.07" "persistent process supervision"
.SH NAME
perp-setup \- initialize a perp installation
.SH SYNOPSIS
.B perp-setup [
.I basedir
.B ] [
.I ctldir
.B ]
.SH DESCRIPTION
.B perp-setup
is a post-installation configuration script intended to
automate the setup of a
.B perp
system.
It is usually run only one-time,
after the installation of the
.B perp
package.
.PP
.B perp-setup
configures the base service directory as
given by the argument
.IR basedir .
If the
.I basedir
argument is not specified,
.B perp-setup
will use the environmental variable PERP_BASE.
If PERP_BASE is not set or empty,
.B perp-setup
will use a default value for
.IR basedir ,
normally
.IR /etc/perp .
.PP
.B perp-setup
creates the directories
.I basedir
and
.IR basedir/.boot
if they don't already exist.
It then installs the standard
.BR perpboot (8)
scripts
.I rc.log
and
.I rc.perp
into
.IR basedir/.boot ,
and sets them executable.
(If
either of these scripts already exists,
.B perp-setup
leaves them alone and installs the new versions for review,
non-executable,
and with a
.I .new
extension.)
.PP
.B perp-setup
then inspects the installation for the existence of
.IR basedir/.control .
If it does not exist,
.B perp-setup
configures
.I basedir/.control
as a symlink to the directory given by the argument
.IR ctldir .
If the
.I ctldir
argument is not specified,
.B perp-setup
will use the environmental variable PERP_CTL.
If PERP_CTL is not set or empty,
.B perp-setup
will use a default value for
.IR ctrldir ,
normally
.IR /var/run/perp .
Note that the
.B perp-setup
utility does not itself create the
.I ctldir
directory,
only the symlink.
.PP
.B perp-setup
then checks for a sysv-compatible
.BR init (8)
system by looking for the file
.IR /etc/inittab .
If present, and if no
.BR perpboot (8)
entry is found within it,
.B perp-setup
appends an
.BR inittab (5)
entry like the following:
.PP
.RS
.nf
## perpboot:
PB:12345:respawn:/usr/sbin/perpboot -x /etc/perp
.fi
.RE
.PP
Check to see that this entry and the
.BR perpboot (8)
runscripts are suitable for your installation.
A SIGHUP signal to
.BR init (8)
will then start the
.B perp
system:
.PP
.RS
kill -HUP 1
.RE
.PP
Otherwise,
.B perp-setup
checks for a BSD-type
.BR init (8)
system by looking for the file
.IR /etc/rc.local .
If present,
and if no
.BR perpboot (8)
is already found within it,
.B perp-setup
appends an entry like the following:
.PP
.RS
.nf
## perpboot:
if [ -x /usr/sbin/perpboot ]; then
    echo -n ' perpd'
        /usr/sbin/perpboot -d /etc/perp
fi
.fi
.RE
.PP
Check to see that this entry and the
.BR perpboot (8)
runscripts are suitable for your installation.
The
.B perp
system will then start after the system is rebooted: 
.PP
.RS
.nf
shutdown -r now
.fi
.RE
.PP
Whether using
.I inittab
or
.IR rc.local ,
the administrator should look over the boot scripts and modify them if/as necessary for
the specific installation.
.PP
The default
.I rc.log
script installed by
.B perp-setup
configures
.BR tinylog (8)
as the
.BR perpd (8)
logger.
The adminstrator may modify the logger and/or logging options
by editing the script directly.
The
.I rc.log
script also tries to run
.BR tinylog (8)
as an unprivileged user with
.BR runuid (8).
The adminstrator will need to add a ``tinylog'' user/group account
to the system to enable this feature.
.SH FILES
.I /etc/perp/
.RS
The default base operating directory for
.BR perpd (8).
.RE
.PP
.I /etc/perp/.boot/
.RS
Directory containing the startup scripts used by
.BR perpboot .
.RE
.PP
.I /etc/perp/.boot/rc.log
.RS
Control script used by
.B perpboot
to start a logger for
.BR perpd (8).
.RE
.PP
.I /etc/perp/.boot/rc.perp
.RS
Control script used by
.B perpboot
to start up
.BR perpd (8).
.RE
.PP
.IR /etc/perp/.control " [\-\-> " /var/run/perp ]
.RS
Directory (normally a symlink) for runtime control files.
.RE
.PP
.I /etc/inittab
.RS
.BR inittab (5)
configuration file for sysv-compatible system.
.RE
.PP
.I /etc/rc.local
.RS
.BR init (8)
startup script for BSD-compatible system.
.RE
.SH ENVIRONMENT
DESTDIR
.RS
If this variable is defined and non-empty,
.B perp-setup
prepends
.I basedir
with this value before making directories and installing files.
Implies NO_INIT,
that is,
.B perp-setup
will skip setting up any system boot scripts
.I inittab
or
.IR rc.local .
May be useful for package builders.
.RE
.PP
NO_INIT
.RS
If this variable is defined and non-empty,
.B perp-setup
skips installation of any
.BR perpboot (8)
stanzas into the system bootscripts
.I inittab
and
.IR rc.local .
May be useful for package installation scripts,
and/or when using other methods (such as an
.I /etc/rc.d
script) for starting
.BR perpboot (8).
.RE
.PP
PERP_BASE
.RS
If no
.I basedir
argument is given at the command-line on startup,
.B perp-setup
checks for a value defined by PERP_BOOT.
If this is not defined or empty,
.B perp-setup
uses a built-in default, normally
.IR /etc/perp .
.RE
.PP
PERP_CTL
.RS
If no
.I ctldir
argument is given at the command-line on startup,
.B perp-setup
checks for a value defined by PERP_CTL.
If this is not defined or empty,
.B perp-setup
uses a built-in default, normall
.IR /var/run/perp .
.SH AUTHOR
Wayne Marshall, http://b0llix.net/perp/
.SH SEE ALSO
.nh
.BR perp_intro (8),
.BR perpboot (8),
.BR perpctl (8),
.BR perpd (8),
.BR perpetrate (5),
.BR perphup (8),
.BR perpls (8),
.BR perpok (8),
.BR perpstat (8),
.BR sissylog (8),
.BR tinylog (8),
.BR runuid (8)
.\" EOF perp-setup.8
